.TH dns_ip4 3
.SH NAME
dns_ip4 \- look up IPv4 addresses
.SH SYNTAX
.B #include <dns.h>

int \fBdns_ip4\fP(stralloc* \fIout\fR,stralloc* \fIfqdn\fR);
.SH DESCRIPTION
dns_ip4 looks up 4-byte IP addresses for the fully-qualified domain name in
\fIfqdn\fR. It puts the concatenation of the IP addresses into \fIout\fR and
returns 0. If the domain does not exist in DNS, or has no IP addresses,
\fIout\fR will be empty.

If dns_ip4 has trouble with the DNS lookup or runs out of memory, it returns
-1, setting errno appropriately. It may or may not change \fIout\fR.

If \fIfqdn\fR is a dotted-decimal IP address, dns_ip4 puts that IP address into
\fIout\fR without checking DNS. More generally, if \fIfqdn\fR is a
dot-separated sequence of dotted-decimal IP addresses, dns_ip4 puts those IP
addresses into out without checking DNS. Brackets may appear inside the
dotted-decimal IP addresses; they are ignored.
.SH "SEE ALSO"
dns_ip4_packet(3), dns_ip6(3), dns_name4(3)
